Skip to content

Subsystem 3c-ii: in-game data commands as Discord slash commands (/pop /time /wipe /online /offline /team /alive) - #12

Merged
HandyS11 merged 6 commits into
developfrom
feat/slash-data-commands
Jun 17, 2026
Merged

Subsystem 3c-ii: in-game data commands as Discord slash commands (/pop /time /wipe /online /offline /team /alive)#12
HandyS11 merged 6 commits into
developfrom
feat/slash-data-commands

Conversation

@HandyS11

Copy link
Copy Markdown
Owner

Subsystem 3c-ii — In-game data commands as Discord slash commands

Surfaces the read-only in-game !command data set into Discord as native ephemeral slash commands. This is the final slice of subsystem 3.

Scope note: 3c-ii was originally planned as a #commands text channel. During design it was re-scoped to native slash commands (friendlier UX, matches the catalog's "components/slash first" decision). No #commands channel; no Discord→in-game relay.

What's added — 7 slash commands

Command Data In-game equivalent
/pop player count !pop
/time in-game time !time
/wipe last wipe !wipe
/online online team members !online
/offline offline team members !offline
/team all member names !team
/alive survival times !alive

All replies are ephemeral (only the caller sees them), consistent with /help / /uptime / /leader.

  • Server targeting via an optional server parameter with autocomplete — defaults when one server is registered, disambiguates when several (filters by typed input, 25-cap).
  • /steamid and /prox were dropped (both in-game-caller-centric — irrelevant in Discord); /mute//unmute excluded (gate in-game output); !afk stays deferred.

Architecture

All in the existing RustPlusBot.Features.Commands project — no new project, entity, migration, event, option, or background service.

  • ServerCommandModule (thin InteractionModuleBase) — the 7 slash commands.
  • ServerAutocompleteHandler — server-name choices per guild.
  • ServerResolver (tested) — the 0/1/many/explicit server-targeting rule.
  • ServerQueryService (tested) — a thin adapter that builds a synthetic CommandContext and reuses the existing in-game ICommandHandler instances, so in-game and slash replies cannot drift. Reply text reuses existing localization keys; only three command.server.* errors are new (EN/FR).

Verification

  • Build 0 warnings / 0 errors under strict analyzers; jb ReformatAndReorder-clean.
  • Full suite 258 green across 7 assemblies (Commands 83→91, +8 new tests); no other assembly regressed.
  • No EF model drift — only Features.Commands src + tests changed.
  • Built subagent-driven (per-task TDD + spec/quality reviews) + a final whole-branch opus review = ready to merge. The final review independently verified the one design risk: all 7 reused handlers read only GuildId/ServerId/Culture, never the synthetic sender/args fields.

🤖 Generated with Claude Code

HandyS11 and others added 5 commits June 17, 2026 14:22
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…reg test

Address final whole-branch review minors: ServerAutocompleteHandler now
filters the guild's servers by the user's in-progress text (case-insensitive)
before the 25-cap, so a server past the 25th alphabetically is reachable;
CommandRegistrationTests now asserts the 'wipe' handler is registered (the
count tripwire alone wouldn't catch a rename of the newly-surfaced /wipe).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings June 17, 2026 12:52

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new Discord “server data” slash-command surface that reuses the existing in-game ICommandHandler implementations, ensuring consistent reply formatting/localization between in-game and Discord while keeping the Discord path read-only and ephemeral.

Changes:

  • Introduces /pop, /time, /wipe, /online, /offline, /team, /alive slash commands via a new ServerCommandModule.
  • Adds server targeting infrastructure (autocomplete + resolver + handler adapter) and registers it in the Commands DI setup.
  • Extends command localization with 3 new command.server.* error strings and adds unit tests for server resolution and handler execution.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/RustPlusBot.Features.Commands.Tests/Servers/ServerResolverTests.cs Adds unit tests for server targeting rules (0/1/many/explicit).
tests/RustPlusBot.Features.Commands.Tests/Servers/ServerQueryServiceTests.cs Adds unit tests ensuring the synthetic CommandContext is built correctly and routed to the right handler.
tests/RustPlusBot.Features.Commands.Tests/CommandRegistrationTests.cs Updates DI test wiring to include server services and asserts new registrations.
src/RustPlusBot.Features.Commands/Servers/ServerResolver.cs Implements server selection logic + localized error outcomes.
src/RustPlusBot.Features.Commands/Servers/ServerResolution.cs Adds a small result record for server resolution outcomes.
src/RustPlusBot.Features.Commands/Servers/ServerQueryService.cs Adapts slash commands to existing in-game handlers via a synthetic context.
src/RustPlusBot.Features.Commands/Servers/ServerAutocompleteHandler.cs Adds guild server-name autocomplete for the optional server slash option.
src/RustPlusBot.Features.Commands/Modules/ServerCommandModule.cs Adds the 7 ephemeral slash commands and orchestrates resolve + query execution.
src/RustPlusBot.Features.Commands/Localization/CommandLocalizationCatalog.cs Adds EN/FR strings for server-selection error cases.
src/RustPlusBot.Features.Commands/CommandServiceCollectionExtensions.cs Registers ServerResolver and ServerQueryService into the Commands feature DI.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/RustPlusBot.Features.Commands/Servers/ServerResolver.cs
Comment thread tests/RustPlusBot.Features.Commands.Tests/Servers/ServerResolverTests.cs Outdated
- ServerResolver ctor XML doc: 'servers' is the IServerService, not a list.
- Rename ServerResolver test DefaultsToSingleServer_IgnoringArg ->
  DefaultsToSingleServer_WhenNoArg: it passes a null arg, so the name now
  matches what it covers. (The single-server + explicit-non-matching-arg ->
  'unknown' path is already covered by ReturnsUnknownError_WhenArgNotRegistered.)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@HandyS11
HandyS11 merged commit b83fe3d into develop Jun 17, 2026
3 checks passed
@HandyS11
HandyS11 deleted the feat/slash-data-commands branch June 17, 2026 13:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants